﻿<dx:DXWindow
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxd="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:loki="clr-namespace:Loki.UI.Wpf;assembly=Loki.UI.Wpf"
    xmlns:Loki2="clr-namespace:Loki.UI.Wpf.Binds;assembly=Loki.UI.Wpf"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    x:Class="Loki.UI.Wpf.Test.MainView"
    Title="MainWindow" WindowState="Maximized">
    <dx:DXWindow.Resources>
        <Style TargetType="dxb:BarButtonItem" x:Key="MNI_Style">
            <Setter Property="BarItemDisplayMode" Value="Default" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Search">
                    <Setter Property="Glyph" Value="{StaticResource MNI_search}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Save">
                    <Setter Property="Glyph" Value="{StaticResource MNI_save}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Refresh">
                    <Setter Property="Glyph" Value="{StaticResource MNI_refresh}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Export">
                    <Setter Property="Glyph" Value="{StaticResource MNI_search}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <DataTemplate x:Key="mni_template">
            <ContentControl>
                <!--"-->
                <dxb:BarButtonItem Content="{Binding DisplayName}"
                                   GlyphAlignment="Top"
                                   GlyphSize="Large"
                                   Style="{StaticResource MNI_Style}"
                                   BarItemDisplayMode="Default"
                                   Command="{Binding Command}" />
            </ContentControl>
        </DataTemplate>
        <Style TargetType="dxn:NavBarGroup">
            <Setter Property="Header" Value="{Binding DisplayName}" />
            <Setter Property="ItemsSource" Value="{Binding Children}" />
        </Style>
        <Style TargetType="dxn:NavBarItem">
            <Setter Property="loki:Bind.Model" Value="{Binding}" />
        </Style>
    </dx:DXWindow.Resources>
    <dxb:BarManager>
        <dxb:BarManager.Bars>
            <dxb:Bar x:Name="mainMenuBar" ItemStyle="{StaticResource MNI_Style}" ItemTemplate="{StaticResource mni_template}" Caption="Main Menu" IsMainMenu="True" DataContext="{Binding Menu}" ItemLinksSource="{Binding Items}">
                <dxb:Bar.DockInfo>
                    <dxb:BarDockInfo ContainerType="Right" />
                </dxb:Bar.DockInfo>
            </dxb:Bar>
            <dxb:Bar x:Name="statusBar" Caption="Status Bar" IsStatusBar="True">
                <dxb:Bar.DockInfo>
                    <dxb:BarDockInfo ContainerType="Bottom" />
                </dxb:Bar.DockInfo>
            </dxb:Bar>
        </dxb:BarManager.Bars>
        <Grid Background="Transparent">
            <dxdo:DockLayoutManager ItemsSource="{Binding Documents.Children}" loki:Bind.Model="{Binding Documents.Children}">
                <dxd:MVVMHelper.LayoutAdapter>
                    <loki:DocumentItemLayoutAdapter HostingGroupName="DocumentGroup" />
                </dxd:MVVMHelper.LayoutAdapter>
                <dxdo:DockLayoutManager.AutoHideGroups>
                    <dxdo:AutoHideGroup DockType="Left">
                        <dxdo:LayoutPanel Caption="Navigation menu">
                            <dxn:NavBarControl ItemsSource="{Binding Navigation.Children}">
                                <dxn:NavBarControl.View>
                                    <dxn:NavigationPaneView />
                                </dxn:NavBarControl.View>
                            </dxn:NavBarControl>
                        </dxdo:LayoutPanel>
                    </dxdo:AutoHideGroup>
                </dxdo:DockLayoutManager.AutoHideGroups>
                <dxdo:LayoutGroup>
                    <dxdo:DocumentGroup loki:Bind.Model="{Binding Documents}" Name="DocumentGroup" MDIStyle="Tabbed" CaptionLocation="Top" ClosePageButtonShowMode="InActiveTabPageHeader">
                        <dxdo:DocumentGroup.ItemStyle>
                            <Style TargetType="{x:Type dxdo:DocumentPanel}">
                                <Setter Property="loki:Bind.Model" Value="{Binding}" />
                            </Style>
                        </dxdo:DocumentGroup.ItemStyle>
                    </dxdo:DocumentGroup>
                </dxdo:LayoutGroup>
            </dxdo:DockLayoutManager>
        </Grid>
    </dxb:BarManager>
</dx:DXWindow>